package com.dpj.book.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import com.alibaba.fastjson.JSONObject;
import com.dpj.book.pojo.User;
import com.dpj.book.service.UserService;
import com.dpj.book.service.impl.UserServiceImpl;

//@WebServlet("/loginServlet")
//public class LoginServlet extends HttpServlet {
//    private UserService userService=new UserServiceImpl();
//    @Override
//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        // 设置请求参数的中文乱码
//        request.setCharacterEncoding("utf-8");
//
//        User user = JSONObject.parseObject(request.getReader().readLine(), User.class);
//        System.out.println(user);
//        User user1=userService.selectByUser(user);
//        if(user1!=null){
//            response.getWriter().write("success");
//        }else {
//            response.getWriter().write("error");
//        }
//
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        doGet(request, response);
//    }
//}
